<?php

use App\Http\Middleware\IptoRegion;

Route::get('/', 'HomeController@index');



// prefix:URL前添加admin
// namespace:控制器命名空间前加上Admin
Route::group(['prefix'=>'admin', 'namespace' => 'Admin'], function() {
    // 不需要登陆验证
    // 登陆，登出
    Route::any('/login','UserController@login');
    Route::any('/loginout','UserController@loginout');

    // 运动会内容查询
    Route::any('/sport/meeting/selectTournament/{sportsmeetingId}','SportsMeetingController@selectTournament');
    Route::any('/sport/meeting/selectAthlete/{sportsmeetingId}&{tournameId}','SportsMeetingController@selectAthlete');
    Route::any('/sport/meeting/selectRound/{sportsmeetingId}','SportsMeetingController@selectRound');
    
    
    // 需登陆验证
    Route::group(['middleware' => 'auth.user:user'], function () { 
        //  后台首页
        Route::any('','AdminController@index');

        // 比赛项目
        Route::any('/sport/tournament','TournamentController@index');
        Route::any('/sport/tournament/add','TournamentController@add');
        Route::any('/sport/tournament/update/{id}','TournamentController@update');
        Route::any('/sport/tournament/remove/{id}','TournamentController@remove');

        // 用户
        Route::any('/user','UserController@index');
        Route::any('/user/add','UserController@add');
        Route::any('/user/update/{id}','UserController@update');
        Route::any('/user/remove/{id}','UserController@remove');
        

        // 团队
        Route::any('/team','TeamController@index');
        Route::any('/team/add','TeamController@add');
        Route::any('/team/update/{id}','TeamController@update');
        Route::any('/team/remove/{id}','TeamController@remove');

        // 运动员
        Route::any('/sport/athlete','AthleteController@index');
        Route::any('/sport/athlete/add','AthleteController@add');
        Route::any('/sport/athlete/update/{id}','AthleteController@update');
        Route::any('/sport/athlete/remove/{id}','AthleteController@remove');

        // 运动会
        Route::any('/sport/meeting','SportsMeetingController@index');
        Route::any('/sport/meeting/add','SportsMeetingController@add');
        Route::any('/sport/meeting/update/{id}','SportsMeetingController@update');
        Route::any('/sport/meeting/addGrade','SportsMeetingController@addGrade');
        Route::any('/sport/meeting/addRegister','SportsMeetingController@addRegister');
        Route::any('/sport/meeting/remove/{id}','SportsMeetingController@remove');

        // 成绩
        Route::any('/sport/grade','GradeController@index');
        Route::any('/sport/grade/search','GradeController@search');
        

    });

});




